﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace PersonaLibrary.Commands.EditCommands
{
    public class SimplyNewCommand<TViewModel> : CommandBase
        where TViewModel : ViewModel.IViewModel
    {
        public override bool CanExecute(object parameter)
        {
            return (((App)Application.Current).ServerAvailable);
        }

        public override void Execute(object parameter)
        {
            ViewModel.IViewModel viewModel = (ViewModel.IViewModel)Activator.CreateInstance(typeof(TViewModel));
            viewModel.View.Show();
        }
    }
}
